pos = haystack.find(needle) pos = haystack.find(needle, offset) #returns -1 when not found: pos = haystack.index(needle) pos = haystack.index(needle, offset) #raises ValueError when not found: #Also can be used to compare if needle in haystack: